<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('订单列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                        <li>
                            <p>订单编号：</p>
                            <input name="orderSn" type="text"/>
                        </li>

                        <!--<li class="select-time">-->
                            <!--<p>支付时间：</p>-->
                            <!--<input class="time-input" id="startTime" name="params[beginPaymentTime]" placeholder="开始时间"-->
                                   <!--type="text"/>-->
                            <!--<span>-</span>-->
                            <!--<input class="time-input" id="endTime" name="params[endPaymentTime]" placeholder="结束时间"-->
                                   <!--type="text"/>-->
                        <!--</li>-->
                        <!--<li class="select-time">-->
                            <!--<p>发货时间：</p>-->
                            <!--<input class="time-input" id="startTime" name="params[beginDeliveryTime]" placeholder="开始时间"-->
                                   <!--type="text"/>-->
                            <!--<span>-</span>-->
                            <!--<input class="time-input" id="endTime" name="params[endDeliveryTime]" placeholder="结束时间"-->
                                   <!--type="text"/>-->
                        <!--</li>-->
                        <li class="select-time">
                            <p>订单状态：</p>
                            <select name="account" heigh="80px">
                                <option>全部订单</option>
                                <option>待支付</option>
                                <option>待发货</option>
                                <option>待收货</option>
                                <option>交易完成</option>
                                <option>交易关闭</option>
                                <option>待售后</option>
                            </select>
                        </li>
                        <li>
                            <p>店铺ID：</p>
                            <input name="storeId" type="text"/>
                        </li>
                        <li>
                            <p>用户ID：</p>
                            <input name="memberId" type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="mall:order:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table data-mobile-responsive="true" id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('mall:order:edit')}]];
    var removeFlag = [[${@permission.hasPermi('mall:order:remove')}]];
    var prefix = ctx + "mall/order";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            detailUrl: prefix + "/detail",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "订单",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '订单id',
                    visible: false
                },
                {
                    field: 'memberId',
                    title: '用户编号'
                },
                {
                    field: 'storeId',
                    title: '店铺ID'
                },
                {
                    field: 'orderSn',
                    title: '订单编号'
                },
                {
                    field: 'memberUsername',
                    title: '用户帐号'
                },
                {
                    field: 'totalAmount',
                    title: '订单总金额'
                },
                {
                    field: 'payAmount',
                    title: '应付金额'
                },
                {
                    field: 'freightAmount',
                    title: '运费金额'
                },
                {
                    field: 'couponAmount',
                    title: '优惠券抵扣金额'
                },

                {
                    field: 'payType',
                    title: '支付方式'
                },
                {
                    field: 'status',
                    title: '订单状态'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="detailUrl(\'' + row.id + '\')">详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function detailUrl(id){
        console.log(id)
        $.modal.open("订单详情", prefix + "/detail?id="+id);
    }
</script>
</body>
</html>
